home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cocktail / reuse.lha / reuse / c / Source.c < prev    next >
C/C++ Source or Header  |  1992-08-18  |  1KB  |  59 lines

  1. /* $Id: Source.c,v 1.0 1992/08/07 14:31:43 grosch rel $ */
  2.  
  3. /* $Log: Source.c,v $
  4.  * Revision 1.0  1992/08/07  14:31:43  grosch
  5.  * Initial revision
  6.  *
  7.  */
  8.  
  9. /* Ich, Doktor Josef Grosch, Informatiker, Juli 1992 */
  10.  
  11. static char rcsid [] = "$Id: Source.c,v 1.0 1992/08/07 14:31:43 grosch rel $";
  12.  
  13. # include "Source.h"
  14.  
  15. # ifdef __cplusplus
  16. extern "C" {
  17. # include "System.h"
  18. }
  19. # else
  20. # include "System.h"
  21. # endif
  22.  
  23. int BeginSource
  24. # if defined __STDC__ | defined __cplusplus
  25.    (char * FileName)
  26. # else
  27.    (FileName) char * FileName;
  28. # endif
  29. {
  30.    return OpenInput (FileName);
  31. }
  32.  
  33. int GetLine
  34. # if defined __STDC__ | defined __cplusplus
  35.    (int File, char * Buffer, int Size)
  36. # else
  37.    (File, Buffer, Size) int File; char * Buffer; int Size;
  38. # endif
  39. {
  40.    register int n = Read (File, Buffer, Size);
  41. # ifdef Dialog
  42. # define IgnoreChar ' '
  43.    /* Add dummy after newline character in order to supply a lookahead for rex. */
  44.    /* This way newline tokens are recognized without typing an extra line.      */
  45.    if (n > 0 && Buffer [n - 1] == '\n') Buffer [n ++] = IgnoreChar;
  46. # endif
  47.    return n;
  48. }
  49.  
  50. void CloseSource
  51. # if defined __STDC__ | defined __cplusplus
  52.    (int File)
  53. # else
  54.    (File) int File;
  55. # endif
  56. {
  57.    Close (File);
  58. }
  59.